Repository navigation
Add Cinder quota, usage and default-class queries - #10
Merged
Mohammed Naser (mnaser) merged 1 commit intoDec 4, 2026
Merged
Mohammed Naser (mnaser) merged 1 commit into
Mohammed Naser (mnaser) merged 1 commit into
Conversation
Mohammed Naser (mnaser)
requested changes
Dec 3, 2026
Mohammed Naser (mnaser)
left a comment
Member
There was a problem hiding this comment.
The SQL queries (QuotaGetAllByProject, QuotaUsageGetAllByProject, QuotaClassGetDefaults), ParseQuotaResource helper, and sqlc generation all look solid—thanks for cleaning these up in the second commit to align with the rest of openstackdb.
A few items to address before we run CI and merge:
- Rebase onto
mainto resolve the merge conflict inAPI.md(from Designate #9). - Update the PR title and description to match the final code, and squash the two commits into one clean commit (keeping DCO sign-off). Right now the title is the raw branch name (
Contrib/cinder quotas 2b1) and the description still describes commit 1 (QuotaGetActiveLimits,QuotaRepository, Python/SQLite tests, and CI workflow edits). - Move the detailed Cinder quota docs from
README.mdintoAPI.md:README.mdis meant to stay a concise overview (as in #13 and Designate #9, which only add a summary table entry toREADME.mdand put detailed query semantics inAPI.md). - Fixture nit: In
tests/fixtures/cinder_quotas.sql, usedeleted = 1for soft-deleted rows rather than3/4/5, since Cinder'sdeletedcolumn is a booleantinyint(1)(unlike Nova/Manila's integer row-ID soft-delete). - Optional: Consider adding smoke calls for the three new queries to
TestCinderQueriesintests/queries_test.gofor consistency with #11 and #12. Also note thatParseQuotaResourcelooks clean as a library helper, though your exporter PR (#162) currently doesn't call it—worth confirming whether you plan to wire it up there.
This was referenced Dec 3, 2026
Add three read-only Cinder quota queries, named after the Cinder DB API
functions they follow, that read every project at once and return raw
rows:
- QuotaGetAllByProject: active project limits from quotas.
- QuotaUsageGetAllByProject: cached in_use and reserved counters from
quota_usages, including projects without limit overrides.
- QuotaClassGetDefaults: limits of the persisted default quota class.
Rows with a NULL or empty project ID are excluded, because Cinder quota
rows belong to Keystone projects. Results are ordered by project,
resource and row ID. Duplicate rows, NULL, zero and -1 limits are
returned as stored. The existing exporter quota queries are unchanged.
Add ParseQuotaResource, which splits per-volume-type keys
("<part>_<volume type name>") using Cinder's known parts and global
resource names, so backup_gigabytes and type names with underscores are
not misread.
Add quota_classes to the Cinder schema fixture, a MariaDB integration
test with a quota fixture, smoke calls in TestCinderQueries, and API.md
documentation.
Co-authored-by: David Hulick <dave.hulick@gmail.com>
Signed-off-by: David Hulick <dave.hulick@gmail.com>
Signed-off-by: Jeremy Lee <jeremy.lee1664@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Jeremy Lee (legit-ninja)
force-pushed
the
contrib/cinder-quotas-2b1
branch
from
December 3, 2026 16:29
ac0dc8b to
61d4612
Compare
Mohammed Naser (mnaser)
approved these changes
Dec 4, 2026
Mohammed Naser (mnaser)
left a comment
Member
There was a problem hiding this comment.
Thanks for the updates—CI is green, approving and merging.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Cinder quota, usage and default-class queries
Summary
Add independent, read-only Cinder quota queries for retrieving active project limits, quota usage, and default-class limits without requiring callers to reconstruct these values from existing joined queries.
Motivation
The existing quota-led
QuotaGetAllWithUsagejoin omits projects that have usage but no explicit quota override, does not exposereserved, and multiplies limit rows when several usage rows match. Reading limits, usage and class defaults separately lets callers resolve effective limits themselves: project override, then thedefaultclass, then service configuration.Behavior
-1(unlimited) are returned as stored.reservedalready counts open reservations.ParseQuotaResourcematches Cinder's known global resources and per-type parts (volumes,gigabytes,snapshots), sobackup_gigabytesand type names that contain underscores are not misread. Keys hold the type name, not its ID, and remain after a type is deleted.Changes
QuotaGetActiveLimits,QuotaGetActiveUsage, andQuotaGetDefaultClassLimits.QuotaRepositoryfacade for quota reads and current volume-type retrieval.quota_classes.Compatibility
The changes are additive. Existing Cinder queries, exported signatures, volume filters, and attachment behavior are preserved.
The
quota_classesaddition is part of the embedded schema fixture used for tests and code generation; it is not a production database migration.Validation
sqlc v1.30.0.go vetand formatting checks passed.The Python/SQLite tests provide fast, Docker-free checks of selected SQL semantics. They are complementary to the native MariaDB tests, not a substitute for them. Because SQLite differs from MariaDB in schema syntax and comparison behavior, the native integration suite remains the database-compatibility check.
We're open to adjustments to the testing approach or public API organization if maintainers prefer different conventions.